package com.example.springaop.controller;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author : niu niu
 * @version : 1.0.0
 * @date : 2023/5/7 12:12
 */
@RestController
@RequestMapping("/user")
public class UserController {
    @RequestMapping("/hi")
    public String sayHi(String name) {
        System.out.println("调用sayHi");
        return "hi , " + name;
    }

    @RequestMapping("/hello")
    public String hello() {
        System.out.println("调用 hello");
        return "hello world";
    }

    @RequestMapping("/exception")
    public String exception() throws Exception {

        System.out.println("执行 exception" + 1 / 0);

        return "exception";
    }
}
